package com.xt.springmvc.controller;

import com.xt.springmvc.entity.Emp;
import com.xt.springmvc.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
public class EmpController {

    @Autowired
    private EmpService empService;
    @RequestMapping("/get/all")
    public String getAll(Model model) {
        // 1、查询数据
        List<Emp> empList = empService.list();
        // 2.存入模型
        model.addAttribute("empList", empList);
        return "emp-list";

    }
}
